From 1fcfff68612633466d526bf8295ae33ab04351e0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 29 Nov 2017 20:13:26 -0500 Subject: [PATCH] dnd: Stop using gdk_cursor_new_from_pixbuf We can just use gdk_cursor_new_from_texture here. --- gtk/gtkdnd.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index f452f4053c..b48a64ec0b 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -244,7 +244,7 @@ static void set_icon_helper (GdkDragContext *context, static struct { GdkDragAction action; const gchar *name; - GdkPixbuf *pixbuf; + GdkTexture *texture; GdkCursor *cursor; } drag_cursors[] = { { GDK_ACTION_DEFAULT, NULL }, @@ -442,17 +442,12 @@ gtk_drag_get_event_actions (const GdkEvent *event, } static void -ensure_drag_cursor_pixbuf (int i) +ensure_drag_cursor_texture (int i) { - if (drag_cursors[i].pixbuf == NULL) + if (drag_cursors[i].texture == NULL) { char *path = g_strconcat ("/org/gtk/libgtk/cursor/", drag_cursors[i].name, ".png", NULL); - GInputStream *stream = g_resources_open_stream (path, 0, NULL); - if (stream != NULL) - { - drag_cursors[i].pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL); - g_object_unref (stream); - } + drag_cursors[i].texture = gdk_texture_new_from_resource (path); g_free (path); } } @@ -482,8 +477,8 @@ gtk_drag_get_cursor (GtkWidget *widget, if (drag_cursors[i].cursor == NULL) { - ensure_drag_cursor_pixbuf (i); - drag_cursors[i].cursor = gdk_cursor_new_from_pixbuf (drag_cursors[i].pixbuf, 0, 0, NULL); + ensure_drag_cursor_texture (i); + drag_cursors[i].cursor = gdk_cursor_new_from_texture (drag_cursors[i].texture, 0, 0, NULL); } return drag_cursors[i].cursor; -- 2.30.2